package com.dd.ent.car.service.forum;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.dd.ent.car.common.config.UIConfig;
import com.dd.ent.car.common.config.UrlConfig;
import com.dd.ent.car.service.BaseService;
import com.dd.ent.car.ui.home.templet.choice.ChoiceFragment;
import com.pp.ent.base.log.MLog;

import org.json.JSONObject;

/**
 * Created by dengqu on 2017/2/22.
 */

public class ForumService extends BaseService {
    public void getListForum() {
        String url = UrlConfig.QUERY_ALL_NOTE;
        get(url, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                MLog.debug(TAG, "queryAllFeedVideo response=" + response);
                notifyUI(UIConfig.QUERY_ALL_NOTE_SUCCESS, response == null ? null : response.toString());
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                MLog.error(TAG, error);
                notifyUI(UIConfig.QUERY_ALL_NOTE_FAIL);
            }
        });
    }

    public void getForumByPage(int page, int size) {
        String url = UrlConfig.QUERY_NOTE_BY_PAGE + "page=" + page + "&size=" + size;
        get(url, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                MLog.debug(TAG, "queryAllFeedVideo response=" + response);
                notifyUI(UIConfig.QUERY_ALL_NOTE_SUCCESS, response == null ? null : response.toString());
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                MLog.error(TAG, error);
                notifyUI(UIConfig.QUERY_ALL_NOTE_FAIL);
            }
        });
    }

}
